**************************************************************************
**** How ideology shapes the relationship between  populist attitudes ****
****** and support for liberal democratic values. Evidence from Spain ****
**************************************************************************

**************************************************************************
****************************** Marc Guinjoan *****************************
********************* Universiat Oberta de Catalunya *********************
**************************************************************************

use Popdemocracy, clear 

*set controls and scheme
global controls "age female education knowledge epices i.linzmoreno extreme"
set scheme s1mono

***Figure 1: Histogram dependent variables, by ideology
quiet reg s_expression ipop2d $controls
foreach var of varlist s_expression s_freedom  s_minority  {
local graphtitle : variable label `var'
hist `var' if e(sample) , plot(hist `var' if (ideol<0.5), recast(line) lc("228 26 28") lw(medthick) lp(dash) || hist `var' if (ideol==0.5), recast(line) lc("255 127 0") lw(medthick)  || hist `var' if (ideol>0.5), recast(line) lp(shortdash) lc("55 126 184")) lw(medthick) ytitle( , height(5)) title(`graphtitle')   xtitle("", height(4)) legend(col(4) label(1 "All") label(2 "Leftist") label(3 "Centrist") label(4 "Rightist") position(6) height(3)) xlabel(0 "Opposes" 0.2 0.4 0.6 0.8 1 "Favours") graphregion(color(white)) color(gs10) fintensity(inten60) name(`var', replace) scale(0.9)
}
hist pt_noleader if e(sample) , plot(hist pt_noleader if (ideol<0.5), recast(line) lc("228 26 28") lw(medthick) lp(dash) || hist pt_noleader if (ideol==0.5), recast(line) lc("255 127 0") lw(medthick)  || hist pt_noleader if (ideol>0.5), recast(line) lp(shortdash) lc("55 126 184")) lw(medthick) ytitle( , height(5)) title("Separation of powers [H1]")   xtitle("", height(4)) legend(col(4) label(1 "All") label(2 "Leftist") label(3 "Centrist") label(4 "Rightist") position(6) height(3)) xlabel(0 "Opposes" 0.2 0.4 0.6 0.8 1 "Favours") graphregion(color(white)) color(gs10) fintensity(inten60) name(pt_noleader, replace) scale(0.9)
grc1leg2 pt_noleader s_expression s_freedom  s_minority , col(2) l2title("Density",  size(small)) graphregion(color(white)) name(histogram_DV, replace)
graph export "figure1.pdf", replace

***Figure 2: Histogram of populist attitudes, by ideology
hist ipop2d if e(sample), plot(hist ipop2d if (ideol<0.5 & e(sample)), lc("228 26 28") recast(line) lw(medthick) lp(dash) bin(16) || hist ipop2d if (ideol==0.5 & e(sample)), lc("255 127 0") recast(line) lw(medthick) bin(16) || hist ipop2d if (ideol>0.5 & e(sample)), lp(shortdash) recast(line) lc("55 126 184")) lw(medthick) bin(16) ytitle( , height(5)) xtitle("Populist attitudes", height(4)) legend(col(4) label(1 "All") label(2 "Leftist") label(3 "Centrist") label(4 "Rightists") position(6) height(3)) xlabel(0 `""No populist" "attitudes""' 0.2 0.4 0.6 0.8 1 `""High populist        " "attitudes     ""') graphregion(color(white)) color(gs10) fintensity(inten60) name(hist_populism, replace)  scale(0.9)
graph export "figure2.pdf", replace

***Figure 3. Populist attitudes, ideology and support for liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ipop2d  c.ideol $controls
eststo interac_`var': reg `var' c.ipop2d##c.ideol $controls
margins, at(ipop2d=(0.2 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle') name(`var', replace) ytitle("") xtitle("") xlabel(0.2 `""Low" "populism""' 0.4 0.6 0.8 1 `""High" "populism""')  graphregion(color(white)) addplot(hist ipop2d if e(sample) & ipop2d>=0.2, bin(13) xlabel(0.2 `""(0.2) Low" "populism""' 0.4 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist"))  scale(0.8)
}

grc1leg2 pt_noleader s_expression s_freedom  s_minority , col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(ipop2_ideol, replace)
gr_edit .legend.plotregion1.label[1].style.editstyle size(small) editcopy 
gr_edit .legend.plotregion1.label[2].style.editstyle size(small) editcopy 
gr_edit .legend.plotregion1.key[1].xsz.editstyle 10 editcopy 
gr_edit .legend.plotregion1.key[2].xsz.editstyle 10 editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle area(linestyle(pattern(dash))) editcopy

graph export "figure3.pdf", replace

egen stdipop2d = std(ipop2d)
egen stdideol =std(ideol)
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
reg `var' c.stdipop2d##c.stdideol $controls
margins, at(stdipop2d=(-4.170572  1.359176) stdideol=(-1.798425)) pwcompare  // Left
margins, at(stdipop2d=(-4.170572  1.359176) stdideol=(2.240868)) pwcompare  // Right
}

***Figure 4: Marginal effects of populist attitudes on liberal democratic values across different values of ideology
foreach var of varlist pt_noleader s_expression s_freedom  s_minority  {
local graphtitle : variable label `var'
sum `var'
reg `var' c.ipop2d##c.ideol ideol $controls
margins, at(ipop2d=(0.2 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(ipop2d=(0.2 1) ideol=(1)) pwcompare(effects)  // rightists 
quiet margins, at(ideol=(0 1) ipop2d=(0.2 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
quiet reg `var' c.ipop2d##c.ideol $controls
margins, dydx(ipop2d) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var', replace)
}

graph combine margins_pt_noleader margins_s_expression margins_s_freedom  margins_s_minority  , col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figure4, replace)
graph export "figure4.pdf", replace
graph close margins_pt_noleader margins_s_expression margins_s_freedom  margins_s_minority

***Table 2: Populism, ideology and support for the liberal democratic values
esttab baseline_pt_noleader interac_pt_noleader baseline_s_expression interac_s_expression baseline_s_freedom interac_s_freedom  baseline_s_minority  interac_s_minority  using "Table2.rtf", title("Table 2: Populism, ideology and support for the liberal democratic values") mtitles ("SP" "SP" "EXP" "EXP" "FR" "FR"  "MIN" "MIN") nonumbers coeflabels(knowledge "Pol.know" epices "Deprivation" ipop2d "Pop.att" _cons "Constant" c.ipop2d#c.ideol "Pop.att*Ideol") label nogaps starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(2) se(2) r2 replace

*End analysis in manuscript. 

**********************************************************************************************************
**********************************************************************************************************
**********************************************************************************************************

***************************************
**** Online Supporting Information ****
***************************************

***** Appendix B: Descriptive statistics and correlates *****

tab linzmoreno, gen(linz)
label variable linz1 "Id: Only Spanish"
label variable linz2 "Id: More Spanish"
label variable linz3 "Id: Dual"
label variable linz4 "Id: More regional"
label variable linz5 "Id: Only regional"

***Table B1. Statistic descriptives 
quiet reg s_expression ipop2d ideol extreme linz1 linz2 linz3 linz4 linz5 knowledge epices age female education

asdoc sum pt_noleader s_expression s_freedom  s_minority ipop2d ippl ielt imnq ideol extreme linz1 linz2 linz3 linz4 linz5 knowledge epices    female education age s_taxes galtan if e(sample), replace label  dec(3) save(tableB1) fs(11) font(Times) title(Table A1. Statistic descriptives)

preserve 
keep pt_noleader s_expression s_freedom  s_minority ipop2d ippl ielt imnq ideol extreme linzmoreno knowledge epices    female education age s_taxes galtan 
save12 correlations, replace
restore

***Figure B2. Correlation matrix for liberal democratic values, populism and ideology
*In R file. 

***** Appendix C: Robustness checks for populist attitudes *****

***Figure C1a & C1b: Sensitivity test for populist attitudes, ideology and support for the liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority  {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ipop2d  ideol $controls
eststo interac_`var': reg `var' c.ipop2d##c.ideol $controls
margins, at(ipop2d=(0.4 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(ipop2d=(0.4 1) ideol=(1)) pwcompare(effects)  // rightists 
margins, at(ipop2d=(0.4 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle') ytitle("") xtitle("") xlabel(0.4 `""0.4 - Low" "populism""' 0.4 0.6 0.8 1 `""1 - High" "populism""')  graphregion(color(white)) addplot(hist ipop2d if e(sample) & ipop2d>=0.4, bin(10) xlabel(0.4 `""(0.4) Low" "populism""' 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist"))  scale(0.8) name(`var', replace) 

margins, dydx(ipop2d) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var', replace)

quiet margins, at(ideol=(0 1) ipop2d=(0.4 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted C1a
grc1leg2 pt_noleader s_expression s_freedom  s_minority, col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figurec1a, replace)
graph export "figureC1a.pdf", replace

*Marginal C1b
graph combine margins_pt_noleader margins_s_expression margins_s_freedom  margins_s_minority, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figurec1b, replace)
graph export "figureC1b.pdf", replace
graph close *pt_noleader *s_expression *s_freedom  *s_minority

***Figure C2a & C2b: Populist attitudes (Goertzian), ideology and support for the liberal democratic values
*Populist attitudes Goertzian: People-centrism*Anti-elitism
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ipop2dmult ideol $controls
eststo interac_`var': reg `var' c.ipop2dmult##c.ideol $controls
margins, at(ipop2dmult=(0 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(ipop2dmult=(0 1) ideol=(1)) pwcompare(effects)  // rightists 
margins, at(ipop2dmult=(0 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle')  ytitle("") xtitle("") xlabel(0 `""Low" "populism""' 0.2 0.4 0.6 0.8 1 `""High" "populism""')  graphregion(color(white)) addplot(hist ipop2dmult if e(sample), bin(13) xlabel(0 `""(0) Low" "populism""' 0.2 0.4 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist")) scale(0.8) name(`var'_ipop2dmult, replace)

margins, dydx(ipop2dmult) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_ipop2dmult, replace)

quiet margins, at(ideol=(0 1) ipop2dmult=(0 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted C2a
grc1leg pt_noleader_ipop2dmult s_expression_ipop2dmult s_freedom_ipop2dmult s_minority_ipop2dmult, col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figurec2a, replace)
graph export "figureC2a.pdf", replace

*Marginal C2b
graph combine margins_pt_noleader_ipop2dmult margins_s_expression_ipop2dmult margins_s_freedom_ipop2dmult  margins_s_minority_ipop2dmult, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figurec2b, replace)
graph export "figureC2b.pdf", replace
graph close *pt_noleader_ipop2dmult *s_expression_ipop2dmult *s_freedom_ipop2dmult *s_minority_ipop2dmult

***Figure C2c & C2d: Populist attitudes (Goertzian), ideology and support for the liberal democratic values
*Populist attitudes Goertzian: People-centrism*Anti-elitism*Manicheism
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ipopmult ideol $controls
eststo interac_`var': reg `var' c.ipopmult##c.ideol $controls
margins, at(ipopmult=(0 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(ipopmult=(0 1) ideol=(1)) pwcompare(effects)  // rightists 
margins, at(ipopmult=(0 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle')  ytitle("") xtitle("") xlabel(0 `""Low" "populism""' 0.2 0.4 0.6 0.8 1 `""High" "populism""')  graphregion(color(white)) addplot(hist ipopmult if e(sample), bin(13) xlabel(0 `""(0) Low" "populism""' 0.2 0.4 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist")) scale(0.8)name(`var'_ipopmult, replace)

margins, dydx(ipopmult) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_ipopmult, replace)

quiet margins, at(ideol=(0 1) ipopmult=(0 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted C2c
grc1leg pt_noleader_ipopmult s_expression_ipopmult s_freedom_ipopmult s_minority_ipopmult, col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureC2c, replace)
graph export "figureC2c.pdf", replace

*Marginal C2d
graph combine margins_pt_noleader_ipopmult margins_s_expression_ipopmult margins_s_freedom_ipopmult  margins_s_minority_ipopmult, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figurec2d, replace)
graph export "figureC2d.pdf", replace
graph close *pt_noleader_ipopmult *s_expression_ipopmult *s_freedom_ipopmult *s_minority_ipopmult

***** C3. Different dimensions of populism *****

*** Figure C3a & C3b: Populist attitudes, ideology and support for the liberal democratic values
*Measure adding the Manichean outlook in the operationalisation of populist attitudes
*Populism 3 dimensions: People-centrism, Anti-elitism and Manicheism
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ipopcast ideol $controls
eststo interac_`var': reg `var' c.ipopcast##c.ideol $controls
margins, at(ipopcast=(0.2 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(ipopcast=(0.2 1) ideol=(1)) pwcompare(effects)  // rightists 
margins, at(ipopcast=(0.2 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle') name(`var'_ipopcast, replace) ytitle("") xtitle("") xlabel(0.2 `""Low" "populism""' 0.4 0.6 0.8 1 `""High" "populism""')  graphregion(color(white)) addplot(hist ipopcast if e(sample) & ipopcast>=0.2, bin(13) xlabel(0.2 `""(0.2) Low" "populism""' 0.4 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist")) scale(0.8)

margins, dydx(ipopcast) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_ipopcast, replace)

quiet margins, at(ideol=(0 1) ipopcast=(0.2 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted C3a
grc1leg pt_noleader_ipopcast s_expression_ipopcast s_freedom_ipopcast s_minority_ipopcast, col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureC3a, replace)
graph export "figureC3a.pdf", replace

*Average C3b
graph combine margins_pt_noleader_ipopcast margins_s_expression_ipopcast margins_s_freedom_ipopcast  margins_s_minority_ipopcast, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figurec3b, replace)
graph export "figureC3b.pdf", replace
graph close *pt_noleader_ipopcast *s_expression_ipopcast *s_freedom_ipopcast *s_minority_ipopcast

*** Figure C3c & C3d: People centrism, ideology and support for the liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ippl  ideol $controls
eststo interac_`var': reg `var' c.ippl##c.ideol $controls
margins, at(ippl=(0.2 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(ippl=(0.2 1) ideol=(1)) pwcompare(effects)  // rightists 
margins, at(ippl=(0.2 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle')  ytitle("") xtitle("") xlabel(0.2 `""Low people-  " "centrism""' 0.4 0.6 0.8 1 `""High people-  " "centrism""')  graphregion(color(white)) addplot(hist ippl if e(sample) & ippl>=0.2, bin(10) xlabel(0.2 `""(0.2) Low" "people-" "centrism""' 0.4 0.6 0.8 1 `""(1) High" "people-" "centrism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist")) scale(0.8) name(`var'_ippl, replace)

margins, dydx(ippl) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_ippl, replace)

quiet margins, at(ideol=(0 1) ippl=(0.2 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted C3c
grc1leg pt_noleader_ippl s_expression_ippl s_freedom_ippl s_minority_ippl, col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureC3c, replace)
graph export "figureC3c.pdf", replace

*Average C3d
graph combine margins_pt_noleader_ippl margins_s_expression_ippl margins_s_freedom_ippl  margins_s_minority_ippl, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figurec3d, replace)
graph export "figureC3d.pdf", replace
graph close *pt_noleader_ippl *s_expression_ippl *s_freedom_ippl *s_minority_ippl

*** Figure C3e & C3f: Anti-elitism, ideology and support for the liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ielt ideol $controls
eststo interac_`var': reg `var' c.ielt##c.ideol $controls
margins, at(ielt=(0.2 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(ielt=(0.2 1) ideol=(1)) pwcompare(effects)  // rightists 
margins, at(ielt=(0.2 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle') ytitle("") xtitle("") xlabel(0.2 `""Low anti-" "elitism""' 0.4 0.6 0.8 1 `""High anti-" "elitism""')  graphregion(color(white)) addplot(hist ielt if e(sample) & ielt>=0.2, bin(10) xlabel(0.2 `""(0.2) Low  " "anti-elitism  ""' 0.4 0.6 0.8 1 `""(1) High  " "anti-elitism  ""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist")) scale(0.8) name(`var'_ielt, replace) 

margins, dydx(ielt) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_ielt, replace)

quiet margins, at(ideol=(0 1) ielt=(0.2 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted C3e
grc1leg pt_noleader_ielt s_expression_ielt s_freedom_ielt s_minority_ielt, col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureC3e, replace)
graph export "figureC3e.pdf", replace

*Average C3f
graph combine margins_pt_noleader_ielt margins_s_expression_ielt margins_s_freedom_ielt margins_s_minority_ielt, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figurec3f, replace)
graph export "figureC3f.pdf", replace
graph close *pt_noleader_ielt *s_expression_ielt *s_freedom_ielt *s_minority_ielt

***Figure C3g & C3h: Manicheism, ideology and support for the liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' imnq ideol $controls
eststo interac_`var': reg `var' c.imnq##c.ideol $controls
margins, at(imnq=(0.2 1) ideol=(0)) pwcompare(effects) // leftists 
margins, at(imnq=(0.2 1) ideol=(1)) pwcompare(effects)  // rightists 
margins, at(imnq=(0.2 (0.1) 1) ideol=(0 1))
marginsplot, title(`graphtitle')  ytitle("") xtitle("") xlabel(0.2 `""Low" "Manicheism""' 0.4 0.6 0.8 1 `""High" "Manicheism ""')  graphregion(color(white)) addplot(hist imnq if e(sample) & imnq>=0.2, bin(10) xlabel(0.2 `""(0.2) Low" "Manicheism""' 0.4 0.6 0.8 1 `""(1) High  " "Manicheism   ""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "Leftist" 4 "Rightist")) ) legend(order(1 "Leftist" 2 "Rightist")) scale(0.8) name(`var'_imnq, replace)

margins, dydx(imnq) at(ideol=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "Leftist" 0.2 0.4 0.6 0.8 1 "Rightist") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_imnq, replace)

quiet margins, at(ideol=(0 1) imnq=(0.2 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted C3g
grc1leg pt_noleader_imnq s_expression_imnq s_freedom_imnq s_minority_imnq, col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureC3g, replace)
graph export "figureC3g.pdf", replace

*Average C3h
graph combine margins_pt_noleader_imnq margins_s_expression_imnq margins_s_freedom_imnq margins_s_minority_imnq, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across ideology"',  size(small)) graphregion(color(white)) name(figurec3h, replace)
graph export "figureC3h.pdf", replace
graph close *pt_noleader_imnq *s_expression_imnq *s_freedom_imnq *s_minority_imnq

***** Appendix D: Robustness checks for ideology *****

***Figure D1a D1b: Populist attitudes, welfare state and support for the liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority    {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ipop2d  s_taxes $controls
eststo interac_`var': reg `var' c.ipop2d##c.s_taxes $controls
margins, at(ipop2d=(0.2 1) s_taxes=(0)) pwcompare(effects) // leftists 
margins, at(ipop2d=(0.2 1) s_taxes=(1)) pwcompare(effects)  // rightists 
margins, at(ipop2d=(0.2 (0.1) 1) s_taxes=(0 1))
marginsplot, title(`graphtitle') ytitle("") xtitle("") xlabel(0.2 `""Low" "populism""' 0.4 0.6 0.8 1 `""High" "populism""')  graphregion(color(white)) addplot(hist ipop2d if e(sample) & ipop2d>=0.2, bin(13) xlabel(0.2 `""(0.2) Low" "populism""' 0.4 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "More taxes" 4 "Less taxes")) ) legend(order(1 "More taxes" 2 "Less taxes")) scale(0.8) name(`var'_taxes, replace) 

margins, dydx(ipop2d) at(s_taxes=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "More taxes" 0.2 0.4 0.6 0.8 1 "Less taxes") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_taxes, replace)

quiet margins, at(s_taxes=(0 1) ipop2d=(0.2 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

*Predicted D1a 
grc1leg2 pt_noleader_taxes s_expression_taxes s_freedom_taxes  s_minority_taxes , col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureD1a, replace)
graph export "figureD1a.pdf", replace

*Average D1b
graph combine margins_pt_noleader_taxes margins_s_expression_taxes margins_s_freedom_taxes margins_s_minority_taxes, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across welfare state support"',  size(small)) graphregion(color(white)) name(figurec3h, replace)
graph export "figureD1b.pdf", replace
graph close *pt_noleader_taxes *s_expression_taxes *s_freedom_taxes  *s_minority_taxes

*** Figure D2a & D2b: Populist attitudes, new politics and support for the liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority    {
local graphtitle : variable label `var'
eststo baseline_`var': reg `var' ipop2d  galtan $controls
eststo interac_`var': reg `var' c.ipop2d##c.galtan  $controls
margins, at(ipop2d=(0.2 1) galtan=(0)) pwcompare(effects) // leftists 
margins, at(ipop2d=(0.2 1) galtan=(1)) pwcompare(effects)  // rightists 
margins, at(ipop2d=(0.2 (0.1) 1) galtan=(0 1))
marginsplot, title(`graphtitle') name(`var'_galtan, replace) ytitle("") xtitle("") xlabel(0.2 `""Low" "populism""' 0.4 0.6 0.8 1 `""High" "populism""')  graphregion(color(white)) addplot(hist ipop2d if e(sample) & ipop2d>=0.2, bin(13) xlabel(0.2 `""(0.2) Low" "populism""' 0.4 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6) legend(order(3 "GAL: libertarian/postmaterialist" 4 "TAN: traditional/authoritarian")) ) legend(order(1 "GAL: libertarian/postmaterialist" 2 "TAN: traditional/authoritarian")) scale(0.8)

margins, dydx(ipop2d) at(galtan=(0 (0.1) 1)) 
marginsplot, title(`graphtitle') xlabel(0 "GAL" 0.2 0.4 0.6 0.8 1 "TAN") yline(0, lc("228 26 28") lw(medthick)) ytitle("") scale(0.9) legend(off) name(margins_`var'_galtan, replace)
quiet margins, at(galtan=(0 1) ipop2d=(0 1) ) post 
test _b[3._at] - _b[1._at] = _b[4._at] - _b[2._at]
}

**Predicted D2a
grc1leg2 pt_noleader_galtan s_expression_galtan s_freedom_galtan  s_minority_galtan , col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureD2c, replace)
gr_edit .legend.plotregion1.label[1].style.editstyle size(small) editcopy 
gr_edit .legend.plotregion1.label[2].style.editstyle size(small) editcopy 
graph export "figureD2a.pdf", replace

*Average D2b
graph combine margins_pt_noleader_galtan margins_s_expression_galtan margins_s_freedom_galtan margins_s_minority_galtan, col(2) l2title(`"Marginal effects of moving from a non-populist"' `"to a populist individual across GAL/TAN values"',  size(small)) graphregion(color(white)) name(figured2d, replace)
graph export "figureD2b.pdf", replace
graph close *pt_noleader_galtan *s_expression_galtan *s_freedom_galtan  *s_minority_galtan 

******Appendix E. Robustness checks with age

recode age (18/41=0 "Younger population") (42/68=1 "Older population"), gen(older)

***** Appendix F: Addressing selection bias *****

***Figure F2. Populist attitudes, ideology and support for liberal democratic values
foreach var of varlist pt_noleader s_expression s_freedom  s_minority {
local graphtitle : variable label `var'
eststo interac_`var': reg `var' c.ipop2d##c.ideol##i.older $controls
margins, at(ipop2d=(0.2 (0.1) 1) ideol=(0 1) older=(0 1))
marginsplot, title(`graphtitle') name(`var'_age, replace) ytitle("") xtitle("") xlabel(0.2 `""Low" "populism""' 0.4 0.6 0.8 1 `""High" "populism""')  graphregion(color(white)) addplot(hist ipop2d if e(sample) & ipop2d>=0.2, bin(13) xlabel(0.2 `""(0.2) Low" "populism""' 0.4 0.6 0.8 1 `""(1) High" "populism""') yaxis(2) percent yscale(alt axis(2)) ytitle("", axis(2)) ylabel("", axis(2)) bcolor() color(%6)  legend(order(5 "Younger leftist" 6 "Older leftist" 7 "Younger rightist" 8 "Older rightist")))    scale(0.8)
}

grc1leg2 pt_noleader_age s_expression_age s_freedom_age  s_minority_age , col(2) l2title(`"Predicted probabilities"' `"Less democracy to more liberal democracy"',  size(small)) graphregion(color(white)) name(figureF2, replace)
gr_edit .legend.plotregion1.label[1].style.editstyle size(small) editcopy 
gr_edit .legend.plotregion1.label[2].style.editstyle size(small) editcopy 
gr_edit .legend.plotregion1.label[3].style.editstyle size(small) editcopy 
gr_edit .legend.plotregion1.label[4].style.editstyle size(small) editcopy 
gr_edit .legend.plotregion1.key[1].xsz.editstyle 10 editcopy 
gr_edit .legend.plotregion1.key[2].xsz.editstyle 10 editcopy
gr_edit .legend.plotregion1.key[3].xsz.editstyle 10 editcopy
gr_edit .legend.plotregion1.key[4].xsz.editstyle 10 editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle area(linestyle(pattern(dash))) editcopy
graph export "figureF2.pdf", replace

graph close *pt_noleader_age *s_expression_age *s_freedom_age  *s_minority_age

***End do-file. 
